home *** CD-ROM | disk | FTP | other *** search
/ IRIX Patches 1995 March / SGI IRIX Patches 1995 Mar.iso / 5.3_patches / patchSG0000159 / patchSG0000159.idb / usr / include / sys / scip.h.z / scip.h
Encoding:
C/C++ Source or Header  |  1995-03-10  |  6.5 KB  |  216 lines

  1. #define SCIP_MAXTARG    16
  2. #define SCIP_MAXLUN    8
  3. #define SCIP_MAXQUEUE    128
  4. #define SCIP_FLOATQUEUE    (SCIP_MAXQUEUE - (SCIP_MAXTARG - 1))
  5. #define SCIP_SCBSIZE    128
  6. #define SCIP_SCBNUM    SCIP_MAXQUEUE
  7. #define SCIP_MCBNUM    4
  8. #define SCIP_MEMSIZE    (128 * 1024)
  9. #define SCIPSRAM_INITBLOCK 0x2C000
  10. #define SCIP_SRAMSIZE    0x20000
  11.  
  12.  
  13. struct sciprequest
  14. {
  15.     toid_t             timeout_id;
  16.     struct dmamap        *dmamap;
  17.     struct scsi_request    *req;
  18.     struct sciprequest    *next;
  19. };
  20.  
  21.  
  22. struct scip_scb { /* base 0x0 align 0x80 */
  23.     /* Fields filled out by CPU */
  24.     char             opcode;
  25.     char             target;
  26.     char             lun;
  27.     char             tag_type;
  28.     char             xferfactor;    /* min xfer factor to use */
  29.     char             offset;    /* max sync offset to use */
  30.     short             flags;        /* SCIP sets this also */
  31.     char             scsi_cmd[16];
  32.     char             cmd_length;
  33.     char             dma_xlatehi;
  34.     short             dma_offset;
  35.     int             dma_xlatelo;
  36.     int             dma_length;
  37.     char             sense_length;
  38.     char             sense_xlatehi;
  39.     short             sense_offset;
  40.     int             sense_xlatelo;
  41.  
  42.     /* reserved for CPU use */
  43.     char             reserve[20 - sizeof(void *)];
  44.     struct sciprequest    *scipreq;
  45.  
  46.     /* fields filled out by SCIP */
  47.     char             scsi_status;
  48.     char             scip_status;
  49.     char             sense_gotten;
  50.     char             odd_byte;
  51.     int             dma_resid;
  52.     int             error_data[3];
  53.  
  54.     /* reserved for SCIP use */
  55.     int             scip_reserved[10];
  56.     int             op_id;
  57. };
  58.  
  59. /*
  60.  * Constants for SCB.flags / struct scip_scb.flags
  61.  *
  62.  * High bits are set by scip, low bits are set by driver
  63.  */
  64. #define SCB_DIR            0x0001
  65. #define SCB_DO_SYNC             0x0002
  66. #define SCB_DO_WIDE             0x0004
  67. #define SCB_NO_DISC_ALLOW       0x0008
  68. #define SCB_SENSE_ACK        0x0010
  69.  
  70. #define SCB_ODD_BYTE_FLAG    0x4000
  71. #define SCB_COMPLETE        0x8000
  72.  
  73. /*
  74.  * Constants for struct scip_scb.scip_status
  75.  *
  76.  * ILLEGAL_STAT is when the status byte that was returned does not match any
  77.  * defined in the SCSI-2 spec.
  78.  *
  79.  * CHK_COND will have sense data returned with the length of the data in
  80.  * the "sense_gotten" field in the SCB.
  81.  */
  82. #define SCIP_STAT_OK        0x0
  83. #define SCIP_STAT_TIMEOUT    0x4    /* selection timeout */
  84. #define SCIP_STAT_CCABORT    0x5    /* aborted due to contingent allegiance */
  85.  
  86. /* causes error SCB to be generated */
  87. #define FIRM_UNEXP_RESET    0x10    /* Someone reset the SCSI bus            */
  88. #define FIRM_ERR_IDLE        0x11    /* firmware should have had something to do */
  89. #define FIRM_ERR_SRCID        0x12    /* no valid SRCID on reconnect           */
  90. #define FIRM_ERR_RECON_Q    0x13    /* SCB to reconnect to, not on disc Q    */
  91.  
  92. /* causes SCB to be sent back with bad status */
  93. #define WD_ERR_UEI        0x20    /* got a UEI from the WD                 */
  94. #define WD_ERR_UPHAS        0x21    /* unexpected phase on the SCSI bus      */
  95. #define WD_ERR_PARE        0x22    /* parity error on the SCSI bus          */
  96. #define WD_ERR_STOPU        0x23    /* got STOPU (not UPHASE or PARE)        */
  97. #define WD_ERR_VBSYI        0x24    /* got VBUSY status, should never get this  */
  98. #define WD_ERR_MISC_MSG        0x25    /* unrecognizable message in on SCSI bus */
  99. #define WD_ERR_UNEXP_REJECT    0x26    /* Unexpected reject message */
  100. #define WD_ERR_DISC_Q        0x27    /* SCB to remove from DISCONNECT Q not there*/
  101. #define WD_ERR_BAD_INT        0x28    /* stop or int from WD is invalid        */
  102. #define WD_ERR_RS_Q        0x29    /* SCB to rm from Req sense Q not there */
  103. #define WD_ERR_LAST_FLAG    0x2a    /* WD error, last flag not set */
  104.  
  105.  
  106. struct scip_resetcb { /* base 0x2c000 align 0x800 */
  107.     char     opcode;
  108.     char     target;
  109.     short     flags;
  110.     int     lo_iq_remove_base_hi;
  111.     int     lo_iq_remove_base_lo;
  112.     int     lo_iq_add_base_hi;
  113.     int     lo_iq_add_base_lo;
  114.     int     lo_cq_add_base_hi;
  115.     int     lo_cq_add_base_lo;
  116.     int     lo_iq_mask;
  117.     int     med_iq_remove_base_hi;
  118.     int     med_iq_remove_base_lo;
  119.     int     med_iq_add_base_hi;
  120.     int     med_iq_add_base_lo;
  121.     int     med_cq_add_base_hi;
  122.     int     med_cq_add_base_lo;
  123.     int     med_iq_mask;
  124.     int     hi_req_add_base_hi;
  125.     int     hi_req_add_base_lo;
  126.     int     error_scb_addr_hi;
  127.     int     error_scb_addr_lo;
  128.     int     scip_host_id;
  129.     int     complete_intr;
  130.     int     finish_ptr_hi;
  131.     int     finish_ptr_lo;
  132.     int     reserved[8];
  133.     int     op_id;
  134. };
  135.  
  136.  
  137. struct scipfinishinfo
  138. {
  139.     uint             high;
  140.     uint             med;
  141.     uint             low;
  142.     uint             error;
  143. };
  144.  
  145.  
  146. struct scipluninfo
  147. {
  148.     u_char             number;
  149.     u_char             l_ca_req:1,    /* contingent allegiance req */
  150.                  sense_ack:1,    /* ack to FW needed after CA */
  151.                  exclusive:1;    /* exclusive access */
  152.     u_short             refcount;
  153.     struct scsi_request    *waithead;    /* q-head of waiting commands */
  154.     struct scsi_request    *waittail;    /* q-tail of waiting commands */
  155.     struct sciprequest    *active;    /* pointer to active list */
  156.     struct scipluninfo    *nextwait;    /* next lun waiting to issue cmd */
  157.     struct dmamap        *sensemap;    /* for issuing request sense */
  158.     u_char             sense_xlatehi;
  159.     u_short             sense_offset;
  160.     u_int             sense_xlatelo;
  161.     void            (*sense_callback)();
  162.     struct scsi_target_info     tinfo;        /* info about LUN */
  163. };
  164.  
  165. struct scipunitinfo
  166. {
  167.     u_char             number;
  168.     u_char             renegotiate:1,    /* renegotiate xfer params */
  169.                  scipreqbusy:1,    /* unit's scipreq busy */
  170.                  wide_supported:1, /* unit supports wide SCSI */
  171.                  present:1;    /* unit responds to inquiry */
  172.     u_char             min_syncperiod;
  173.     u_char             max_syncoffset;
  174.     struct scipluninfo    *lun[SCIP_MAXLUN];
  175.     struct sciprequest     unitreq;    /* unit's scipreq */
  176. };
  177.  
  178. struct scipctlrinfo
  179. {
  180.     ushort             number;    /* internal ctlr number */
  181.     ushort             quiesce:1,    /* don't issue commands */
  182.                  dead:1,    /* SCIP not responding */
  183.                  reset:1,    /* reset in progress */
  184.                  intr:1,    /* current in intr routine */
  185.                  restartpend:1,    /* restart timeout pending */
  186.                  diff:1,    /* set if differential */
  187.                  external:1,    /* set if bus goes external to chassis */
  188.                  chan:2;    /* channel number on SCIP */
  189.     ushort             cmdcount;    /* # outstanding commands */
  190.     ushort             reset_num;    /* number of resets done */
  191.     uint             scb_iqadd;    /* IQ add pointer */
  192.     uint             scb_hicnt;    /* count of completed hi-pri */
  193.     uint             scb_errcnt;    /* count of errors seen */
  194.     struct scip_scb        *scb_cqremove;    /* CQ remove pointer */
  195.     struct scip_scb        *scb;        /* low pri request queue */
  196.     struct scip_scb        *mcb;        /* medium pri request queue */
  197.     struct scip_scb        *hcb;
  198.     struct scip_scb        *ecb;
  199.     struct scipfinishinfo    *finish;
  200.     struct scipluninfo    *waithead;    /* luns waiting to issue cmds */
  201.     struct scipluninfo    *waittail;    /* last lun in line */
  202.     struct sciprequest    *request;    /* queue of avail requests */
  203.     struct scsi_request    *intrhead;    /* queue used during intr */
  204.     struct scsi_request    *intrtail;    /* queue used during intr */
  205.     volatile u_char        *chip_addr;    /* KV addr of scip registers */
  206.     char            *page;        /* extra page for DMA */
  207.     lock_t             lock;
  208.     lock_t             intrlock;
  209.     struct scipunitinfo    *unit[SCSI_MAXTARG];
  210. };
  211.  
  212. int scipfw_download(volatile u_char *);
  213. int scip_earlyinit(int);
  214. int scip_startup(volatile u_char *);
  215. void scipintr(eframe_t *, __psunsigned_t);
  216.